package com.kaigejava.demo.controller;

import com.kaigejava.demo.business.barrgelog.entity.BarrageLogEntity;
import com.kaigejava.demo.business.barrgelog.service.IBarrageLogService;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @BelongsProject: douyin-live-java
 * @Author: kaigejava
 * @CreateTime: 2023-11-09  14:55
 * @Description: TODO
 * @Version: 1.0
 */
@Controller
@RequestMapping("/")
public class IndexController {

    @Resource
    private IBarrageLogService barrageLogService;

    @GetMapping("/")
    public String toIndex() {
        return "index";
    }


    /**
     * B站
     */

    @GetMapping("/b")
    public String toB() {
        return "b-message";
    }


    /**
     * 抖音
     */

    @GetMapping("/dy")
    public String toDY() {
        return "dy-message";
    }


    /**
     * 斗鱼
     */

    @GetMapping("/dyu")
    public String toDYu() {
        return "dyu-message";
    }

    /**
     * 斗鱼
     */

    @GetMapping("/hy")
    public String toHY() {
        return "hy-message";
    }



    @GetMapping("/save")
    @ResponseBody
    public Long save(){
        BarrageLogEntity entity = new BarrageLogEntity();
        entity.setContent("这是是内容");
        entity.setStatus(0);
        entity.setCreateTime(new Date());
        entity.setStationType("b");
        entity.setSendStatus(0);
        entity.setUserName("我是用户名");
        entity.setUserId(1L);
        Long id = barrageLogService.saveInfo(entity);
        System.out.println("保存后的id是："+id);
        return id;
    }


}
